#ifndef CTABLEPINAUTH_H
#define CTABLEPINAUTH_H

#include "AbstractTable.h"
#include <QDateTime>

struct CPinAuthInfo{
    QString userId;
    int passwdType;
    QString passwd;
    QString saltValue;
    int TEEHandle;
    int fpUid;
    int errTimes;
    int maxErrTimes;
    int forzenSceond;
    QDateTime frozenBeginTime;
};

class CTablePinAuth : public AbstractTable
{
    Q_OBJECT
    explicit CTablePinAuth(QObject *parent = nullptr);
public:
    static CTablePinAuth* getInstance();

    bool addPinAuth(const CPinAuthInfo &info);
    bool deletePinAuth(const QString &userId);
    bool updatePinAuth(const CPinAuthInfo &info);
    QSharedPointer<CPinAuthInfo> pinAuthInfo(const QString &userId);

    //单元格读写
    INT_CELL(passwdType,setPasswdType,"UserId","PasswdType")
    STRING_CELL(passwd,setPasswd,"UserId","Passwd")
    STRING_CELL(saltValue,setSaltValue,"UserId","SaltValue")
    INT_CELL(TEEHandle,setTEEHandle,"UserId","TEEHandle")
    INT_CELL(fpUid,setFpUid,"UserId","FpUid")
    INT_CELL(errTimes,setErrTimes,"UserId","ErrTimes")
    INT_CELL(maxErrTimes,setMaxErrTimes,"UserId","MaxErrTimes")
    INT_CELL(forzenSceond,setForzenSceond,"UserId","ForzenSceond")
    STRING_CELL(frozenBeginTime,setFrozenBeginTime,"UserId","FrozenBeginTime")
};

#endif // CTABLEPINAUTH_H
